package com.bytenose.extrautils.base;

import com.bytenose.extrautils.annotations.UtilityClass;
import com.google.common.base.Function;
import com.google.common.base.Functions;

@UtilityClass
public class Functions2 {
	
	/**
	 * Private constructor to avoid instantiation.
	 */
	private Functions2() {
	}
	
	/**
	 * Returns a function that transforms values by invoking the {@link Object#toString()}
	 * function. This method is the generic counterpart of and behaves exactly as 
	 * {@link Functions#toStringFunction()}.
	 * 
	 * @param <V> the type of objects to transform.
	 * @return the new function.
	 */
	public static <V extends Object> Function<V,String> toStringFunction() {
		return new Function<V,String>() {
			@Override
			public String apply(V input) {
				return input.toString();
			}
		};
	}
}
